Skip to content

Conversation

@mvitousek
Copy link
Contributor

@mvitousek mvitousek commented Aug 14, 2024

Stack from ghstack (oldest at bottom):

Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

[ghstack-poisoned]
@vercel
Copy link

vercel bot commented Aug 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2024 6:41pm

mvitousek added a commit that referenced this pull request Aug 14, 2024
Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

ghstack-source-id: 9009bc1
Pull Request resolved: #30697
Comment on lines +2442 to +2448
return {
kind: 'LoadLocal',
place: expr.node.prefix
? {...newValuePlace}
: {...previousValuePlace},
loc: exprLoc,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine, but we try to avoid using lvalues more than once. The main exception is for method calls, where we evaluate the receiver to an lvalue, then use that lvalue to load the property for the method and again as the receiver of the method call instruction.

To test, can you add some fixtures where the increment/decrement is used as an rvalue? let x = obj.x++ and (obj.x++).toString()

Copy link
Member

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Please see comments before landing with some additional things to test

Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

[ghstack-poisoned]
mvitousek added a commit that referenced this pull request Aug 15, 2024
Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

ghstack-source-id: 8f39799
Pull Request resolved: #30697
@mvitousek mvitousek merged commit 84098f3 into gh/mvitousek/23/base Aug 15, 2024
mvitousek added a commit that referenced this pull request Aug 15, 2024
Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.

ghstack-source-id: 8f39799
Pull Request resolved: #30697
@mvitousek mvitousek deleted the gh/mvitousek/23/head branch August 15, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants